Only optimize out the full configure handling if we got a gratuitous
authorOwen Taylor <otaylor@redhat.com>
Thu, 16 May 2002 23:59:23 +0000 (23:59 +0000)
committerOwen Taylor <otaylor@src.gnome.org>
Thu, 16 May 2002 23:59:23 +0000 (23:59 +0000)
Thu May 16 19:49:24 2002  Owen Taylor  <otaylor@redhat.com>
        * gtk/gtkwindow.c (gtk_window_configure_event): Only
        optimize out the full configure handling if we got
        a gratuitous configure event(configure_request_count == 0)
        and the size didn't change.

        * gtk/gtkwindow.c (gtk_window_move_resize): Use
        g_message(), not g_print() for debug spew.b

        * gtk/gtkwindow.c (gtk_window_real_set_focus): Ref
        the old and new focus widgets for the scope of
        the function.

        * gtk/gtksocket.c gtkplug.c: Remove various #if 0'd
        bits of old code.

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtkplug.c
gtk/gtksocket.c
gtk/gtkwindow.c

index db3da96bb69a1ccd45368c2032ccb2a732c2f511..0a41265ca3f757e51699b5ed13a2c1cc2e6bfd95 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+Thu May 16 19:49:24 2002  Owen Taylor  <otaylor@redhat.com>
+       * gtk/gtkwindow.c (gtk_window_configure_event): Only 
+       optimize out the full configure handling if we got
+       a gratuitous configure event(configure_request_count == 0)
+       and the size didn't change.
+       * gtk/gtkwindow.c (gtk_window_move_resize): Use 
+       g_message(), not g_print() for debug spew.b
+       * gtk/gtkwindow.c (gtk_window_real_set_focus): Ref
+       the old and new focus widgets for the scope of
+       the function.
+       * gtk/gtksocket.c gtkplug.c: Remove various #if 0'd
+       bits of old code.
  Thu May 16 18:47:29 2002  Owen Taylor  <otaylor@redhat.com>
  
        * gtk/gtkwindow.c (gtk_window_show): Disable the
index db3da96bb69a1ccd45368c2032ccb2a732c2f511..0a41265ca3f757e51699b5ed13a2c1cc2e6bfd95 100644 (file)
@@ -1,3 +1,20 @@
+Thu May 16 19:49:24 2002  Owen Taylor  <otaylor@redhat.com>
+       * gtk/gtkwindow.c (gtk_window_configure_event): Only 
+       optimize out the full configure handling if we got
+       a gratuitous configure event(configure_request_count == 0)
+       and the size didn't change.
+       * gtk/gtkwindow.c (gtk_window_move_resize): Use 
+       g_message(), not g_print() for debug spew.b
+       * gtk/gtkwindow.c (gtk_window_real_set_focus): Ref
+       the old and new focus widgets for the scope of
+       the function.
+       * gtk/gtksocket.c gtkplug.c: Remove various #if 0'd
+       bits of old code.
  Thu May 16 18:47:29 2002  Owen Taylor  <otaylor@redhat.com>
  
        * gtk/gtkwindow.c (gtk_window_show): Disable the
index db3da96bb69a1ccd45368c2032ccb2a732c2f511..0a41265ca3f757e51699b5ed13a2c1cc2e6bfd95 100644 (file)
@@ -1,3 +1,20 @@
+Thu May 16 19:49:24 2002  Owen Taylor  <otaylor@redhat.com>
+       * gtk/gtkwindow.c (gtk_window_configure_event): Only 
+       optimize out the full configure handling if we got
+       a gratuitous configure event(configure_request_count == 0)
+       and the size didn't change.
+       * gtk/gtkwindow.c (gtk_window_move_resize): Use 
+       g_message(), not g_print() for debug spew.b
+       * gtk/gtkwindow.c (gtk_window_real_set_focus): Ref
+       the old and new focus widgets for the scope of
+       the function.
+       * gtk/gtksocket.c gtkplug.c: Remove various #if 0'd
+       bits of old code.
  Thu May 16 18:47:29 2002  Owen Taylor  <otaylor@redhat.com>
  
        * gtk/gtkwindow.c (gtk_window_show): Disable the
index db3da96bb69a1ccd45368c2032ccb2a732c2f511..0a41265ca3f757e51699b5ed13a2c1cc2e6bfd95 100644 (file)
@@ -1,3 +1,20 @@
+Thu May 16 19:49:24 2002  Owen Taylor  <otaylor@redhat.com>
+       * gtk/gtkwindow.c (gtk_window_configure_event): Only 
+       optimize out the full configure handling if we got
+       a gratuitous configure event(configure_request_count == 0)
+       and the size didn't change.
+       * gtk/gtkwindow.c (gtk_window_move_resize): Use 
+       g_message(), not g_print() for debug spew.b
+       * gtk/gtkwindow.c (gtk_window_real_set_focus): Ref
+       the old and new focus widgets for the scope of
+       the function.
+       * gtk/gtksocket.c gtkplug.c: Remove various #if 0'd
+       bits of old code.
  Thu May 16 18:47:29 2002  Owen Taylor  <otaylor@redhat.com>
  
        * gtk/gtkwindow.c (gtk_window_show): Disable the
index db3da96bb69a1ccd45368c2032ccb2a732c2f511..0a41265ca3f757e51699b5ed13a2c1cc2e6bfd95 100644 (file)
@@ -1,3 +1,20 @@
+Thu May 16 19:49:24 2002  Owen Taylor  <otaylor@redhat.com>
+       * gtk/gtkwindow.c (gtk_window_configure_event): Only 
+       optimize out the full configure handling if we got
+       a gratuitous configure event(configure_request_count == 0)
+       and the size didn't change.
+       * gtk/gtkwindow.c (gtk_window_move_resize): Use 
+       g_message(), not g_print() for debug spew.b
+       * gtk/gtkwindow.c (gtk_window_real_set_focus): Ref
+       the old and new focus widgets for the scope of
+       the function.
+       * gtk/gtksocket.c gtkplug.c: Remove various #if 0'd
+       bits of old code.
  Thu May 16 18:47:29 2002  Owen Taylor  <otaylor@redhat.com>
  
        * gtk/gtkwindow.c (gtk_window_show): Disable the
index db3da96bb69a1ccd45368c2032ccb2a732c2f511..0a41265ca3f757e51699b5ed13a2c1cc2e6bfd95 100644 (file)
@@ -1,3 +1,20 @@
+Thu May 16 19:49:24 2002  Owen Taylor  <otaylor@redhat.com>
+       * gtk/gtkwindow.c (gtk_window_configure_event): Only 
+       optimize out the full configure handling if we got
+       a gratuitous configure event(configure_request_count == 0)
+       and the size didn't change.
+       * gtk/gtkwindow.c (gtk_window_move_resize): Use 
+       g_message(), not g_print() for debug spew.b
+       * gtk/gtkwindow.c (gtk_window_real_set_focus): Ref
+       the old and new focus widgets for the scope of
+       the function.
+       * gtk/gtksocket.c gtkplug.c: Remove various #if 0'd
+       bits of old code.
  Thu May 16 18:47:29 2002  Owen Taylor  <otaylor@redhat.com>
  
        * gtk/gtkwindow.c (gtk_window_show): Disable the
index 918327a214dd308d3f8a9a0fcdfa144ae354bb5a..fc3b66a8285f6064b49124daaa8250ba6c219005 100644 (file)
@@ -681,23 +681,6 @@ gtk_plug_set_focus (GtkWindow *window,
 
   if (focus && !window->has_focus)
     {
-#if 0      
-      XEvent xevent;
-
-      xevent.xfocus.type = FocusIn;
-      xevent.xfocus.display = GDK_WINDOW_XDISPLAY (plug->socket_window);
-      xevent.xfocus.window = GDK_WINDOW_XWINDOW (plug->socket_window);
-      xevent.xfocus.mode = EMBEDDED_APP_WANTS_FOCUS;
-      xevent.xfocus.detail = FALSE; /* Don't force */
-
-      gdk_error_trap_push ();
-      XSendEvent (GDK_DISPLAY (),
-                 GDK_WINDOW_XWINDOW (plug->socket_window),
-                 False, NoEventMask, &xevent);
-      gdk_display_sync (gdk_drawable_get_display (plug->socket_window));
-      gdk_error_trap_pop ();
-#endif
-
       send_xembed_message (plug, XEMBED_REQUEST_FOCUS, 0, 0, 0,
                           gtk_get_current_event_time ());
     }
@@ -862,19 +845,6 @@ gtk_plug_focus (GtkWidget        *widget,
              
              send_xembed_message (plug, message, 0, 0, 0,
                                   gtk_get_current_event_time ());
-             
-#if 0        
-             gtk_window_set_focus (GTK_WINDOW (widget), NULL);
-
-             gdk_error_trap_push ();
-             XSetInputFocus (GDK_WINDOW_XDISPLAY (plug->socket_window),
-                             GDK_WINDOW_XWINDOW (plug->socket_window),
-                             RevertToParent, event->time);
-             gdk_display_sync (gdk_drawable_get_display (plug->socket_window));
-             gdk_error_trap_pop ();
-
-             gtk_plug_forward_key_press (plug, event);
-#endif       
            }
        }
 
index 14cfbd6c99266a7098d9914f5988e1f0cab518b2..7496ef01c79b6925cf46fad3f3c5bec42d3f18dd 100644 (file)
@@ -785,20 +785,6 @@ static gboolean
 gtk_socket_focus_out_event (GtkWidget *widget, GdkEventFocus *event)
 {
   GtkSocket *socket = GTK_SOCKET (widget);
-
-#if 0
-  GtkWidget *toplevel;
-  toplevel = gtk_widget_get_toplevel (widget);
-  
-  if (toplevel && GTK_IS_WINDOW (toplevel))
-    {
-      XSetInputFocus (GDK_WINDOW_XDISPLAY (toplevel->window),
-                     GDK_WINDOW_XWINDOW (toplevel->window),
-                     RevertToParent, CurrentTime); /* FIXME? */
-    }
-
-#endif      
-
   if (socket->plug_window)
     {
       send_xembed_message (socket, XEMBED_FOCUS_OUT, 0, 0, 0,
@@ -821,20 +807,6 @@ gtk_socket_claim_focus (GtkSocket *socket)
   GTK_WIDGET_SET_FLAGS (socket, GTK_CAN_FOCUS);
   gtk_widget_grab_focus (GTK_WIDGET (socket));
   GTK_WIDGET_UNSET_FLAGS (socket, GTK_CAN_FOCUS);
-  
-  /* FIXME: we might grab the focus even if we don't have
-   * it as an app... (and see _focus_in ()) */
-  if (socket->plug_window)
-    {
-#if 0      
-      gdk_error_trap_push ();
-      XSetInputFocus (GDK_WINDOW_XDISPLAY (socket->plug_window),
-                     GDK_WINDOW_XWINDOW (socket->plug_window),
-                     RevertToParent, GDK_CURRENT_TIME);
-      gdk_display_sync (gdk_drawable_get_display (socket->plug_window));
-      gdk_error_trap_pop ();
-#endif
-    }
 }
 
 static gboolean
@@ -876,67 +848,6 @@ gtk_socket_focus (GtkWidget *widget, GtkDirectionType direction)
     }
   else
     return FALSE;
-
-#if 0
-  if (!socket->focus_in && socket->plug_window)
-    {
-      GdkScreen *screen = gdk_drawable_get_screen (socket->plug_window);
-      Display *xdisplay = GDK_SCREEN_XDISPLAY (screen);
-      XEvent xevent;
-
-      gtk_socket_claim_focus (socket);
-      
-      xevent.xkey.type = KeyPress;
-      xevent.xkey.window = GDK_WINDOW_XWINDOW (socket->plug_window);
-      xevent.xkey.root = GDK_WINDOW_XWINDOW (gdk_screen_get_root_window (socket->plug_window));
-      xevent.xkey.time = GDK_CURRENT_TIME;
-      /* FIXME, the following might cause big problems for
-       * non-GTK apps */
-      xevent.xkey.x = 0;
-      xevent.xkey.y = 0;
-      xevent.xkey.x_root = 0;
-      xevent.xkey.y_root = 0;
-      xevent.xkey.state = 0;
-      xevent.xkey.same_screen = TRUE; /* FIXME ? */
-
-      switch (direction)
-       {
-       case GTK_DIR_UP:
-         xevent.xkey.keycode =  XKeysymToKeycode(xdisplay, GDK_Up);
-         break;
-       case GTK_DIR_DOWN:
-         xevent.xkey.keycode =  XKeysymToKeycode(xdisplay, GDK_Down);
-         break;
-       case GTK_DIR_LEFT:
-         xevent.xkey.keycode =  XKeysymToKeycode(xdisplay, GDK_Left);
-         break;
-       case GTK_DIR_RIGHT:
-         xevent.xkey.keycode =  XKeysymToKeycode(xdisplay, GDK_Right);
-         break;
-       case GTK_DIR_TAB_FORWARD:
-         xevent.xkey.keycode =  XKeysymToKeycode(xdisplay, GDK_Tab);
-         break;
-       case GTK_DIR_TAB_BACKWARD:
-         xevent.xkey.keycode =  XKeysymToKeycode(xdisplay, GDK_Tab);
-         xevent.xkey.state = ShiftMask;
-         break;
-       }
-
-
-      gdk_error_trap_push ();
-      XSendEvent (GDK_WINDOW_XDISPLAY (socket->plug_window),
-                 GDK_WINDOW_XWINDOW (socket->plug_window),
-                 False, NoEventMask, &xevent);
-      gdk_display_sync (gdk_drawable_get_display (socket->plug_window));
-      gdk_error_trap_pop ();
-      
-      return TRUE;
-    }
-  else
-    {
-      return FALSE;
-    }
-#endif  
 }
 
 static void
@@ -1400,20 +1311,6 @@ gtk_socket_filter_func (GdkXEvent *gdk_xevent, GdkEvent *event, gpointer data)
        {
          gtk_socket_claim_focus (socket);
        }
-      else if (xevent->xfocus.detail == NotifyInferior)
-       {
-#if 0
-         GtkWidget *toplevel;
-         toplevel = gtk_widget_get_toplevel (widget);
-         
-         if (toplevel && GTK_IS_WINDOW (topelevel))
-           {
-             XSetInputFocus (GDK_WINDOW_XDISPLAY (toplevel->window),
-                             GDK_WINDOW_XWINDOW (toplevel->window),
-                             RevertToParent, CurrentTime); /* FIXME? */
-           }
-#endif
-       }
       return_val = GDK_FILTER_REMOVE;
       break;
     case FocusOut:
index e3c274a9856bc31a4b21559b5e3fb589429e59ce..38750d5bfc26d4528a3d305677cc2ea56fbed5f2 100644 (file)
@@ -3529,6 +3529,7 @@ gtk_window_configure_event (GtkWidget         *widget,
                            GdkEventConfigure *event)
 {
   GtkWindow *window = GTK_WINDOW (widget);
+  gboolean expected_reply = window->configure_request_count > 0;
 
   /* window->configure_request_count incremented for each 
    * configure request, and decremented to a min of 0 for
@@ -3553,7 +3554,7 @@ gtk_window_configure_event (GtkWidget         *widget,
    *     notifies and can wait to resize when we get them
    */
   
-  if (window->configure_request_count > 0 ||
+  if (!expected_reply &&
       (widget->allocation.width == event->width &&
        widget->allocation.height == event->height))
     return TRUE;
@@ -3897,8 +3898,20 @@ static void
 gtk_window_real_set_focus (GtkWindow *window,
                           GtkWidget *focus)
 {
+  GtkWidget *old_focus = window->focus_widget;
   gboolean def_flags = 0;
 
+  if (old_focus)
+    {
+      g_object_ref (old_focus);
+      g_object_freeze_notify (G_OBJECT (old_focus));
+    }
+  if (focus)
+    {
+      g_object_ref (focus);
+      g_object_freeze_notify (G_OBJECT (focus));
+    }
+  
   if (window->default_widget)
     def_flags = GTK_WIDGET_HAS_DEFAULT (window->default_widget);
   
@@ -3938,6 +3951,17 @@ gtk_window_real_set_focus (GtkWindow *window,
   if (window->default_widget &&
       (def_flags != GTK_WIDGET_FLAGS (window->default_widget)))
     gtk_widget_queue_draw (window->default_widget);
+
+  if (old_focus)
+    {
+      g_object_thaw_notify (G_OBJECT (old_focus));
+      g_object_unref (old_focus);
+    }
+  if (focus)
+    {
+      g_object_thaw_notify (G_OBJECT (focus));
+      g_object_unref (focus);
+    }
 }
 
 /*********************************
@@ -4337,38 +4361,38 @@ gtk_window_move_resize (GtkWindow *window)
       /* this is the position from the last configure notify */
       gdk_window_get_position (widget->window, &notify_x, &notify_y);
     
-      g_print ("--- %s ---\n"
-               "last  : %d,%d\t%d x %d\n"
-               "this  : %d,%d\t%d x %d\n"
-               "alloc : %d,%d\t%d x %d\n"
-               "req   :      \t%d x %d\n"
-               "resize:      \t%d x %d\n" 
-               "size_changed: %d pos_changed: %d hints_changed: %d\n"
-               "configure_notify_received: %d\n"
-               "configure_request_count: %d\n"
-               "position_constraints_changed: %d\n",
-               window->title ? window->title : "(no title)",
-               info->last.configure_request.x,
-               info->last.configure_request.y,
-               info->last.configure_request.width,
-               info->last.configure_request.height,
-               new_request.x,
-               new_request.y,
-               new_request.width,
-               new_request.height,
-               notify_x, notify_y,
-               widget->allocation.width,
-               widget->allocation.height,
-               widget->requisition.width,
-               widget->requisition.height,
-               info->resize_width,
-               info->resize_height,
-               configure_request_pos_changed,
-               configure_request_size_changed,
-               hints_changed,
-               window->configure_notify_received,
-               window->configure_request_count,
-               info->position_constraints_changed);
+      g_message ("--- %s ---\n"
+                "last  : %d,%d\t%d x %d\n"
+                "this  : %d,%d\t%d x %d\n"
+                "alloc : %d,%d\t%d x %d\n"
+                "req   :      \t%d x %d\n"
+                "resize:      \t%d x %d\n" 
+                "size_changed: %d pos_changed: %d hints_changed: %d\n"
+                "configure_notify_received: %d\n"
+                "configure_request_count: %d\n"
+                "position_constraints_changed: %d\n",
+                window->title ? window->title : "(no title)",
+                info->last.configure_request.x,
+                info->last.configure_request.y,
+                info->last.configure_request.width,
+                info->last.configure_request.height,
+                new_request.x,
+                new_request.y,
+                new_request.width,
+                new_request.height,
+                notify_x, notify_y,
+                widget->allocation.width,
+                widget->allocation.height,
+                widget->requisition.width,
+                widget->requisition.height,
+                info->resize_width,
+                info->resize_height,
+                configure_request_pos_changed,
+                configure_request_size_changed,
+                hints_changed,
+                window->configure_notify_received,
+                window->configure_request_count,
+                info->position_constraints_changed);
     }
 #endif